package com.project.service.ZLGLService.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.project.bean.CustomerBean;
import com.project.mapper.ZLGLmapper.ICustomerMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;


@Service
@Transactional
public class CustomerServiceImpl implements com.project.service.ZLGLService.ICustomerService {
    @Autowired
    private ICustomerMapper mapper;
    @Override
    public void add(CustomerBean customer) {
        mapper.add(customer);
    }

    @Override
    public void update(int id,String inCharge, String tel, String scope) {
            mapper.update(id,inCharge,tel,scope);
    }

    @Override
    public CustomerBean findById(int id) {

        return mapper.findById(id);
    }

    @Override
    public PageInfo<CustomerBean> cutAllByItem(int pageNO, String name, String scope) {
        PageHelper.startPage(pageNO, com.project.service.ZLGLService.ICustomerService.PAGESIZE);

        return PageInfo.of(mapper.cutAllByItem(name, scope));
    }

    @Override
    public List<CustomerBean> findAll() {
        return mapper.findAll();
    }

}
